package com.nvwa.coding.model;

import lombok.Getter;


@Getter
public class Pair<T1, T2> {

    public final T1 _1;
    public final T2 _2;

    public Pair(T1 t1, T2 t2) {
        _1 = t1;
        _2 = t2;
    }

    public static <T1, T2> Pair<T1, T2> of(T1 t1, T2 t2) {
        return new Pair<>(t1, t2);
    }

    public T1 get1() {
        return _1;
    }

    public T2 get2() {
        return _2;
    }

    public T1 left() {
        return _1;
    }

    public T2 right() {
        return _2;
    }

    public T1 getLeft() {
        return _1;
    }

    public T2 getRight() {
        return _2;
    }


    public T1 first() {
        return _1;
    }

    public T2 second() {
        return _2;
    }

    public T1 getFirst() {
        return _1;
    }

    public T2 getSecond() {
        return _2;
    }

    public T1 getKey() {
        return _1;
    }

    public T2 getValue() {
        return _2;
    }

    public T1 key() {
        return _1;
    }

    public T2 value() {
        return _2;
    }

    public Opt<T1> opt1() {
        return Opt.of(_1);
    }

    public Opt<T2> opt2() {
        return Opt.of(_2);
    }

    public Opt<T1> optLeft() {
        return Opt.of(_1);
    }

    public Opt<T2> optRight() {
        return Opt.of(_2);
    }

    public Opt<T1> optFirst() {
        return Opt.of(_1);
    }

    public Opt<T2> optSecond() {
        return Opt.of(_2);
    }

    public Opt<T1> optKey() {
        return Opt.of(_1);
    }

    public Opt<T2> optValue() {
        return Opt.of(_2);
    }


    public <T3> Tuple3<T1, T2, T3> with(T3 _3) {
        return new Tuple3<>(_1, _2, _3);
    }

}
